import React, { PropTypes } from 'react';
import style from './index.less'
import {Table} from 'antd'


/**
 * TableList 表格列表
 */
const TableList = ({
    fieldList = [],
    list = [],
    rowKey='id',
    pagination=false
}) => {
    // 表格数据设置
    const dataSource = list
   
    // 表头设置
    const columns = []
    fieldList.map(item => {
        columns.push({
            title: item.name,
            dataIndex: item.id,
            key: item.id,
            render: (text, record) => text||(text===0?0:'-')
        })
    })
    

    return <Table dataSource={dataSource} columns={columns} rowKey={rowKey} pagination={pagination} />
}
export default TableList;
